$(document).ready(function() {
	var validator = $("#signupform").validate({
		rules: {
			email: {
				required: true,
				email: true,
				remote: "/users/check_email_bind"
			}
		},
		messages: {
			email: {
				required: "请输入有效Email地址",
				minlength: "请输入有效Email地址",
				remote: jQuery.format("{0} 没有被注册过，请核实")
			},
			dateformat: "Choose your preferred dateformat",
			terms: " "
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else
				error.appendTo( element.parent().next() );
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
	});

});

